package cn.itsource.user.controller;

import cn.itsource.basic.utils.AjaxResult;
import cn.itsource.user.service.IWxUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("/wxuser")
public class WxUserController {

    @Autowired
    private IWxUserService wxUserService;

    //接收前台的code参数
    @GetMapping("/wxcode")
    public AjaxResult register(String code){
        System.out.println(code);
        //在后台发起 请求  兑换 access_token
        return  wxUserService.wxLogin(code);

    }

    //接收前台的code参数
    @PostMapping("/bind")
    public AjaxResult bind(@RequestBody HashMap<String,String> map){
        System.out.println(map);
        //1.获取用户的手机号，验证码
        return wxUserService.bind(map);

    }

}
